import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Task3 {
	
	public static void main(String[] args) {
		
		Scanner inputCS = new Scanner(System.in);
		char[] input = inputCS.nextLine().toCharArray();
		Boolean isNumber = false;
		List<Integer> allNumbers = new ArrayList<Integer>();
		StringBuilder number = new StringBuilder();
		
		for (int i = 0; i < input.length; i++) {
			
			if (input[i] == '(') {
				
				isNumber = true;
				continue;
			}
			
			if (input[i] == ')') {
				
				isNumber = false;
				
				allNumbers.add(Integer.parseInt(number.toString().trim()));
				number = new StringBuilder();
				
				continue;
			}
			
			if (isNumber) {
				
				number.append(input[i]);
			}
		}
		
		int sequenceLength = 1;
		Boolean isPreviousEven = false;
		if (allNumbers.get(0) % 2 == 0) {
			
			isPreviousEven = true;
		}
		
		List<Integer> sequences = new ArrayList<Integer>();
		
		for (int i = 1; i < allNumbers.size(); i++) {
			
			Boolean isEven = allNumbers.get(i) % 2 == 0;
			
			if (allNumbers.get(i) == 0) {
				
				isEven = !isPreviousEven;
			}
			
			if (isPreviousEven != isEven) {
				
				sequenceLength++;
			}
			else {
				
				sequences.add(sequenceLength);
				sequenceLength = 1;
			}
			
			isPreviousEven = isEven;
		}
		
		sequences.add(sequenceLength);
		
		int result = 0;
		
		for (int i = 0; i < sequences.size(); i++) {
			
			if (sequences.get(i) > result) {
				
				result = sequences.get(i);
			}
		}
		
		System.out.println(result);
	}
}